Get Your Hands Dirty on Clean Architecture by Tom Hombergs
Author:Tom Hombergs
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2019-09-26T16:00:00+00:00
What about Database Transactions?
We have not touched upon the topic of database transactions yet. Where do we put our transaction boundaries?
A transaction should span all write operations to the database that are performed within a certain use case so that all those operations can be rolled back together if one of them fails.
Since the persistence adapter doesn't know which other database operations are part of the same use case, it cannot decide when to open and close a transaction. We have to delegate this responsibility to the services that orchestrate the calls to the persistence adapter.
The easiest way to do this with Java and Spring is to add the @Transactional annotation to the application service classes so that Spring will wrap all public methods with a transaction:
package buckpal.application.service;
@Transactional
public class SendMoneyService implements SendMoneyUseCase {
...
}
If we want our services to stay pure and not be stained with @Transactional annotations, we can use aspect-oriented programming – for example, with AspectJ – in order to weave transaction boundaries into our codebase.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12644)
Hello! Python by Anthony Briggs(9947)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9822)
The Mikado Method by Ola Ellnestam Daniel Brolund(9813)
Dependency Injection in .NET by Mark Seemann(9368)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8333)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7788)
Grails in Action by Glen Smith Peter Ledbrook(7719)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7590)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7388)
Microservices with Go by Alexander Shuiskov(7149)
Practical Design Patterns for Java Developers by Miroslav Wengner(7072)
Test Automation Engineering Handbook by Manikandan Sambamurthy(7012)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6443)
Angular Projects - Third Edition by Aristeidis Bampakos(6430)
The Art of Crafting User Stories by The Art of Crafting User Stories(5956)
NetSuite for Consultants - Second Edition by Peter Ries(5872)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5683)
Kotlin in Action by Dmitry Jemerov(5092)
